home *** CD-ROM | disk | FTP | other *** search
/ Java for 3D & VRML Worlds / Java for 3d and VRML Worlds.iso / world / motion / motion.wrl < prev    next >
Text File  |  1996-10-17  |  3KB  |  179 lines

  1. #VRML V2.0 utf8
  2. #
  3. # "Motion Shadow Effect"
  4. #     created by ask@krc.sony.co.jp (Masamichi zzzcat Asukai)
  5. #
  6. # Copyright(C) 1996 Sony Corporation. All rights reserved.
  7. #
  8.  
  9. NavigationInfo {
  10.     headlight FALSE
  11. }
  12.  
  13. Viewpoint {
  14.     position 0.0 1.75 30.0
  15. }
  16.  
  17. Background {
  18.     skyColor 0.5 0.3 0.7
  19. }
  20.  
  21. PROTO P_TREE [
  22. ] {
  23.     Billboard {
  24.         # "axisOfRotaion 0 1 0" doesn't work!
  25.         #axisOfRotaion 0 1 0
  26.         axisOfRotation 0 0 0
  27.         children [
  28.             Shape {
  29.                 appearance Appearance {
  30.                     texture ImageTexture {
  31.                         url "tree.gif"
  32.                     }
  33.                 }
  34.                 geometry IndexedFaceSet {
  35.                     coord Coordinate {
  36.                         point [
  37.                         -0.5 0 0,
  38.                          0.5 0 0,
  39.                          0.5 1 0,
  40.                         -0.5 1 0,
  41.                         ]
  42.                     }
  43.                     coordIndex [
  44.                         0, 1, 2, 3, -1,
  45.                     ]
  46.                 }
  47.             }
  48.         ]
  49.     }
  50. }
  51.  
  52. PROTO P_SHADOW [
  53. ] {
  54.     Transform {
  55.         rotation 1 0 0 -1.57
  56.         children [
  57.             Shape {
  58.                 appearance Appearance {
  59.                     material Material {
  60.                         ambientIntensity 0
  61.                         diffuseColor 0 0 0
  62.                         transparency 0.3
  63.                     }
  64.                     texture ImageTexture {
  65.                         url "tree.gif"
  66.                     }
  67.                 }
  68.                 geometry IndexedFaceSet {
  69.                     coord Coordinate {
  70.                         point [
  71.                             -0.5 0 0,
  72.                              0.5 0 0,
  73.                              0.5 1 0,
  74.                             -0.5 1 0,
  75.                         ]
  76.                     }
  77.                     coordIndex [
  78.                         0, 1, 2, 3, -1,
  79.                     ]
  80.                 }
  81.             }
  82.         ]
  83.     }
  84. }
  85.  
  86. DEF TREE Transform {
  87.     translation 0 0 0
  88.     scale 3 3 3
  89.     children [
  90.         P_TREE {}
  91.         DEF SHADOW Transform { 
  92.             children [ P_SHADOW {} ]
  93.         }
  94.     ]
  95. }
  96.  
  97. DEF LIGHT Transform {
  98.     translation -20 10 0
  99.     children [
  100.         PointLight {
  101.             intensity 1.0
  102.         }
  103.         Shape {
  104.             appearance Appearance {
  105.                 material Material {
  106.                     ambientIntensity 0
  107.                     diffuseColor 0 0 0
  108.                     emissiveColor 1 1 0
  109.                 }
  110.             }
  111.             geometry Sphere{
  112.                 radius 0.5
  113.             }
  114.         }
  115.     ]
  116. }
  117.  
  118. DEF L_TIME TimeSensor{
  119.     cycleInterval 10.0
  120.     stopTime -1
  121.     loop TRUE
  122. }
  123.  
  124. DEF POSINT PositionInterpolator{
  125.     set_fraction 0.5
  126.     key [0, 0.25, 0.5, 0.75, 1]
  127.     keyValue [-15 10 5, 5 15 5, 5 10 -15, -15 5 -15, -15 10 5]
  128. }
  129.  
  130. ROUTE L_TIME.fraction_changed TO POSINT.set_fraction
  131. ROUTE POSINT.value_changed TO LIGHT.set_translation
  132.  
  133.  
  134. DEF TIME TimeSensor{
  135.     cycleInterval 0.2
  136.     stopTime -1
  137.     loop TRUE
  138. }
  139.  
  140. DEF SCRIPT Script {
  141.     url "motion.class"
  142.     eventIn SFTime interval
  143.     eventOut SFRotation setRotation
  144.     eventOut SFVec3f setScale
  145.     field SFNode light USE LIGHT
  146.     field SFNode tree USE TREE
  147. ROUTE TIME.cycleTime TO SCRIPT.interval
  148. ROUTE SCRIPT.setRotation TO SHADOW.set_rotation
  149. ROUTE SCRIPT.setScale TO SHADOW.set_scale
  150.  
  151.  
  152. DEF GROUND Transform {
  153.     translation 0 -0.1 0
  154.     children[
  155.         Shape {
  156.             appearance Appearance {
  157.                 material Material {
  158.                     diffuseColor 0.6 0.4 0.4
  159.                     emissiveColor 0.3 0.2 0.2
  160.                 }
  161.             }
  162.             geometry IndexedFaceSet {
  163.                 coord Coordinate {
  164.                     point [
  165.                         -30 0 -30,
  166.                         -30 0  30,
  167.                          30 0  30,
  168.                          30 0 -30,
  169.                     ]
  170.                 }
  171.                 coordIndex [
  172.                     0, 1, 2, 3, -1,
  173.                 ]
  174.             }
  175.                }
  176.     ]
  177. }
  178.